package font;

import java.util.ArrayList;

import config.ConfigType;

import main.ErrorException;

public class AtlasVar
{
	private String m_name;
	private ArrayList<ImageInfo> m_ImageInfos;
	
	public AtlasVar(String name)
	{
		m_name = name;
		m_ImageInfos = new ArrayList<ImageInfo>();
	}
	
	public String getName()
	{
		return m_name;
	}
	
	public void addImageInfo(ImageInfo info)
	{
		for(ImageInfo temp: m_ImageInfos)
		{
			if(temp.m_name.compareTo(info.m_name) == 0)
			{
				return;
			}
		}
		m_ImageInfos.add(info);
	}
	
	public void addToAtlas(Atlas atlas) throws ErrorException
	{
		int padding = ConfigType.E_ATLAS_PADDING_CT.getIntValue();
		for(ImageInfo info: m_ImageInfos)
		{
			info.setWH(padding);
			atlas.addBlock(info);
		}
	}
}
